home *** CD-ROM | disk | FTP | other *** search
- property pSprite, spriteNum, ogRot, ogHe, ogWi, ogLoc, pOgHeight, pOgWidth, pHeightOfDart, pDistanceFromBoard, pBoardHeightFromGround, pGravity, pLoc, pPower, pDiffer
- global gCompDart
-
- on beginSprite me
- pSprite = sprite(spriteNum)
- gCompDart.add(pSprite)
- ogLoc = pSprite.loc
- ogRot = pSprite.rotation
- ogHe = pSprite.height
- ogWi = pSprite.width
- pOgHeight = pSprite.height
- pOgWidth = pSprite.width
- init()
- end
-
- on init me
- pDistanceFromBoard = 96
- pBoardHeightFromGround = 68
- pGravity = 0.25
- pHeightOfDart = 28
- pSprite.height = pOgHeight
- pSprite.width = pOgWidth
- pair = VOID
- end
-
- on cleanUp me
- pSprite.height = ogHe
- pSprite.width = ogWi
- pSprite.loc = ogLoc
- pSprite.rotation = ogRot
- init()
- end
-
- on throw me, theTarget
- set the floatPrecision to 4
- pLoc = [290.0, 300.0]
- pSprite.loc = point(pLoc[1], pLoc[2])
- newloc = [sprite(theTarget).locH.float, sprite(theTarget).locV.float]
- displace = [newloc[1] - pLoc[1], newloc[2] - pLoc[2]]
- dislength = sqrt((displace[1] * displace[1]) + (displace[2] * displace[2]))
- unit = [displace[1] / dislength, displace[2] / dislength]
- thetotdist = dislength
- dispos = 0
- pScale = 1.0
- fullScale = [pSprite.width.float, pSprite.height.float]
- repeat while dislength > 5
- pSprite.rotation = pSprite.rotation + 5
- pSprite.height = fullScale[2] * pScale
- pSprite.width = fullScale[1] * pScale
- pLoc = pLoc + [unit[1] * 5, (unit[2] * 5) + dispos]
- pSprite.loc = point(pLoc[1], pLoc[2])
- displace = [newloc[1] - pLoc[1], newloc[2] - pLoc[2]]
- dislength = sqrt((displace[1] * displace[1]) + (displace[2] * displace[2]))
- ascale = dislength * 100.0 / thetotdist
- if pScale > 0.25 then
- pScale = abs((1.0 - ascale) / 100.0)
- end if
- updateStage()
- end repeat
- puppetSound(3, member("dart hit 2"))
- s = the ticks + 25
- repeat while the ticks < s
- updateStage()
- end repeat
- end
-